package com.gupaoedu.design.observer.proxy.core;

import java.lang.reflect.Method;

/**
 * <p></p>
 *
 * @author Andy
 * @date 2018/3/21.
 */
public class Event {

    /**
     * 源对象
     */
    private Object source;

    /**
     * 目标对象
     */
    private Object target;

    /**
     * 回调方法
     */
    private Method callback;

    /**
     * 触发事件
     */
    private String trigger;

    /**
     * 操作的时间
     */
    private long times;

    public Event(Object target, Method callback) {
        this.target = target;
        this.callback = callback;
    }

    public Object getSource() {
        return source;
    }

    void setSource(Object source) {
        this.source = source;
    }

    public Object getTarget() {
        return target;
    }

    public void setTarget(Object target) {
        this.target = target;
    }

    public Method getCallback() {
        return callback;
    }

    public void setCallback(Method callback) {
        this.callback = callback;
    }

    public String getTrigger() {
        return trigger;
    }

    void setTrigger(String trigger) {
        this.trigger = trigger;
    }

    public long getTimes() {
        return times;
    }

    void setTimes(long times) {
        this.times = times;
    }

    @Override
    public String toString() {
        return "Event{" +
                "\tsource=" + source + "\t\n" +
                "\ttarget=" + target + "\t\n" +
                "\tcallback=" + callback + "\t\n" +
                "\ttrigger=" + trigger + "\t\n" +
                "\ttimes=" + times + "\t\n" +
                '}' + "\n";
    }
}
